package com.rockcent.mall.lib.dto;

import com.rockcent.common.domain.DtoEntity;
import com.rockcent.common.utils.BigDecimalUtils;
import com.rockcent.mall.lib.domain.MerchantOrderItem;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by DK on 16/11/8.
 */
public class MerchantFundFlowDto extends DtoEntity {

    /**
     * 商家账户ID
     */
    private Long merchantFundId;

    /**
     * 商家ID
     */
    private Long merchantId;

    /**
     * 平台订单号
     */
    private String merchantOrderNum;

    /**
     * 总金额
     */
    private Double totalAmount;

    /**
     * 冻结金额
     */
    private Double frozen;

    /**
     * 可用金额
     */
    private Double availableAmount;

    /**
     * 备注
     */
    private String remark;

    /**
     * 操作金额
     */
    private BigDecimal operationAmount;

    /**
     * 交易方向 INCOME("收入", "+"), EXPEND("支出", "-")
     */
    private String transactionFlow;

    /**
     * 交易类型
     */
    private String transactionType;

    /**
     * 平台资金 id
     */
    private Long mallFundId;

    /**
     * 平台 id
     */
    private Long mallId;

    /**
     * 开始时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private String beginDate;

    /**
     * 结束时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private String endDate;

    /**
     * 订单所含产品
     */
    private List<MerchantOrderItem> merchantOrderItemList;

    //佣金支出
    private Double resellExpend;

    //分享支出
    private Double shareExpend;

    //平台服务费支出
    private Double serveExpend;

    //父ID
    private Long parentId;

    private String actualAmount;

    //供应商应付分享返利
    private Double disShareFee;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createDate;

    /**
     * 支付类型
     */
    private String payType;

    /**
     * 平台服务费欠费支出:已结算金额
     */
    BigDecimal settledFee;

    /**
     * 平台服务费欠费支出:余额支付
     */
    BigDecimal balancePayedFee;


    public String getMerchantOrderNum() {
        return merchantOrderNum;
    }

    public void setMerchantOrderNum(String merchantOrderNum) {
        this.merchantOrderNum = merchantOrderNum;
    }

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    public Double getTotalAmount() {
        return BigDecimalUtils.setScale(totalAmount);
    }

    public void setTotalAmount(Double totalAmount) {
        this.totalAmount = totalAmount;
    }

    public Double getFrozen() {
        return BigDecimalUtils.setScale(frozen);
    }

    public void setFrozen(Double frozen) {
        this.frozen = frozen;
    }

    public Double getAvailableAmount() {
        return BigDecimalUtils.setScale(availableAmount);
    }

    public void setAvailableAmount(Double availableAmount) {
        this.availableAmount = availableAmount;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public BigDecimal getOperationAmount() {
        return operationAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public void setOperationAmount(BigDecimal operationAmount) {
        this.operationAmount = operationAmount;
    }

    public String getTransactionFlow() {
        return transactionFlow;
    }

    public void setTransactionFlow(String transactionFlow) {
        this.transactionFlow = transactionFlow;
    }

    public String getTransactionType() {
        return transactionType;
    }

    public void setTransactionType(String transactionType) {
        this.transactionType = transactionType;
    }

    public Long getMallFundId() {
        return mallFundId;
    }

    public void setMallFundId(Long mallFundId) {
        this.mallFundId = mallFundId;
    }

    public String getBeginDate() {
        return beginDate;
    }

    public void setBeginDate(String beginDate) {
        this.beginDate = beginDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public Long getMerchantFundId() {
        return merchantFundId;
    }

    public void setMerchantFundId(Long merchantFundId) {
        this.merchantFundId = merchantFundId;
    }

    public Long getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(Long merchantId) {
        this.merchantId = merchantId;
    }

    public List<MerchantOrderItem> getMerchantOrderItemList() {
        return merchantOrderItemList;
    }

    public void setMerchantOrderItemList(List<MerchantOrderItem> merchantOrderItemList) {
        this.merchantOrderItemList = merchantOrderItemList;
    }

    public Double getResellExpend() {
        return BigDecimalUtils.setScale(resellExpend);
    }

    public void setResellExpend(Double resellExpend) {
        this.resellExpend = resellExpend;
    }

    public Double getShareExpend() {
        return BigDecimalUtils.setScale(shareExpend);
    }

    public void setShareExpend(Double shareExpend) {
        this.shareExpend = shareExpend;
    }

    public Double getServeExpend() {
        return BigDecimalUtils.setScale(serveExpend);
    }

    public void setServeExpend(Double serveExpend) {
        this.serveExpend = serveExpend;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getActualAmount() {
        return actualAmount;
    }

    public void setActualAmount(String actualAmount) {
        this.actualAmount = actualAmount;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public Double getDisShareFee() {
        return disShareFee;
    }

    public void setDisShareFee(Double disShareFee) {
        this.disShareFee = disShareFee;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public BigDecimal getSettledFee() {
        return settledFee;
    }

    public void setSettledFee(BigDecimal settledFee) {
        this.settledFee = settledFee;
    }

    public BigDecimal getBalancePayedFee() {
        return balancePayedFee;
    }

    public void setBalancePayedFee(BigDecimal balancePayedFee) {
        this.balancePayedFee = balancePayedFee;
    }

    @Override
    public String toString() {
        return "MerchantFundFlowDto{" +
                "merchantFundId=" + merchantFundId +
                ", merchantId=" + merchantId +
                ", merchantOrderNum='" + merchantOrderNum + '\'' +
                ", totalAmount=" + totalAmount +
                ", frozen=" + frozen +
                ", availableAmount=" + availableAmount +
                ", remark='" + remark + '\'' +
                ", operationAmount=" + operationAmount +
                ", transactionFlow='" + transactionFlow + '\'' +
                ", transactionType='" + transactionType + '\'' +
                ", mallFundId=" + mallFundId +
                ", mallId=" + mallId +
                ", beginDate='" + beginDate + '\'' +
                ", endDate='" + endDate + '\'' +
                ", merchantOrderItemList=" + merchantOrderItemList +
                ", resellExpend=" + resellExpend +
                ", shareExpend=" + shareExpend +
                ", serveExpend=" + serveExpend +
                ", parentId=" + parentId +
                ", actualAmount='" + actualAmount + '\'' +
                ", disShareFee=" + disShareFee +
                ", createDate='" + createDate + '\'' +
                ", payType='" + payType + '\'' +
                ", settledFee=" + settledFee +
                ", balancePayedFee=" + balancePayedFee +
                '}';
    }
}
